//
// Created by francklinson on 2021/11/22 AT 0:34.
// May Saint Diana bless you!
//

#include <iostream>
#include <vector>
#include <string>

using namespace std;

class Solution {
public:
    int sumBase(int n, int k) {
        //把n变为k进制数
        string s;
        while (n) {
            s.push_back(n % k - 0 + '0');
            n /= k;
        }
        reverse(s.begin(), s.end());
        int ans = 0;
        for (char i : s) {
            ans += i - '0';
        }
        return ans;
    }
};

int main() {
    Solution solution;
    cout << solution.sumBase(34, 6) << endl;
    cout << solution.sumBase(10, 10) << endl;
    return 0;
}

